//
//  NumberCell.m
//  cityStar
//
//  Created by joyban on 15-1-15.
//  Copyright (c) 2015年 tiny. All rights reserved.
//

#import "NumberCell.h"

@implementation NumberCell

+(CGFloat)heightOfTableCell
{
    return 90;
}

- (void)awakeFromNib {
    self.numberTextField.returnKeyType = UIReturnKeyDone;
    self.numberTextField.delegate = self;
    self.dateBeginPicker.datePicker.datePickerMode = UIDatePickerModeDateAndTime;
    self.dateEndPicker.datePicker.datePickerMode = UIDatePickerModeDateAndTime;
    UIToolbar * topView = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 30)];
    [topView setBarStyle:UIBarStyleDefault];
    
    UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    
    UIBarButtonItem * doneButton = [[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStyleDone target:self action:@selector(dismissKeyBoard)];
    
    NSArray * buttonsArray = [NSArray arrayWithObjects:btnSpace,doneButton,nil];
    
    [topView setItems:buttonsArray];
    [self.dateBeginPicker setInputAccessoryView:topView];
    [self.dateEndPicker setInputAccessoryView:topView];
}

-(void)dismissKeyBoard
{
    [self.dateBeginPicker resignFirstResponder];
    [self.dateEndPicker resignFirstResponder];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

@end
